package com.ebs.md.fxmonitor.orders;

/**
 * Perforce Revision:
 *  $File: //depot/MarketData/fxmonitor/main/src/main/java/com/ebs/md/fxmonitor/orders/MultipleOrderBookImpl.java $
 *  $Revision: #4 $  $Change: 115607 $  $DateTime: 2012/10/11 15:02:25 $  $Author: Arik.Sher $
 */

import org.springframework.util.Assert;

import com.ebs.marketdata.dictionary.MatchingType;
import com.ebs.md.api.IDetailedBookEntry;
import com.ebs.md.api.IIdentifiedOrder;
import com.ebs.md.api.IOrderBookManager;
import com.ebs.md.api.IProduct;
import com.ebs.md.api.abs.AbsMultilpleBooksManager;
import com.ebs.md.api.abs.BasicDetailedOrderBook;
import com.ebs.md.api.product.PairProduct;


public class MultipleOrderBookImpl
extends AbsMultilpleBooksManager<IDetailedBookEntry, IIdentifiedOrder>
{

	/**
	 * FIX and CM should not be managed
	 * 
	 */
	protected boolean isProductSupported(IProduct product) {
		boolean retVal = true;
		
		if ( product instanceof PairProduct ) {
			PairProduct pair = (PairProduct)product;
			
			if (   false
				|| pair.getMatchingType() == MatchingType.Fix.getId()
				|| pair.getMatchingType() == MatchingType.CM.getId()
			   )
			{
				retVal = false;
			}
		}
		
		return retVal;
	}

	protected IOrderBookManager<IDetailedBookEntry, IIdentifiedOrder> createOrderBookManager(IProduct product) {
		return new BasicDetailedOrderBook(product);
	}

	public void init() {
		Assert.notNull(orderBookListener, "'orderBookListener' cannot be null");
	}

}
